package com.haorui.lygyd.autotas.controller;

import com.haorui.base.core.exception.BusinessException;
import com.haorui.baseutil.utils.HaoRuiDateUtil;
import com.haorui.lygyd.employeemanager.service.MemberService;
import com.haorui.lygyd.payordermanager.service.OrderRevokeService;
import com.haorui.lygyd.payordermanager.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author 郭飞
 * @version 1.0
 * @project znsm
 * @package com.haorui.znsm.autotas.controller
 * @createDate 2018/3/31 0031 17:50
 * @modfiyDate
 * @function 立即执行任务
 */
@RestController
@Slf4j
public class LiJiRunTaskController {
    @Autowired
    private MemberService memberService;
    @Autowired
    private OrderService orderService;
    @Autowired
    private OrderRevokeService orderRevokeService;


    @RequestMapping(value = "/autotask/excu/taskorderrevoke/{date}",method = RequestMethod.GET)
    public void taskorderrevoke(@PathVariable("date") String date){
        log.info("执行自动取消订单任务立即执行");
        Date sdate=HaoRuiDateUtil.str2Date(date,"yyyy-MM-dd");
        int count=orderRevokeService.getOrderRevokeEntityListByOverdueDateLiJi(sdate);
        log.info("自动取消订单任务立即执行执行完毕,共取消"+count+"个订单");
    }

    @RequestMapping(value = "/autotask/excu/tasklibaotuijianjiangfenhong/{date}",method = RequestMethod.GET)
    public void tasklibaotuijianjiangfenhong(@PathVariable("date") String date) throws BusinessException {
        log.info("开始礼包推荐奖分红手动立即分红");
        Date sdate=HaoRuiDateUtil.str2Date(date,"yyyy-MM-dd");
        log.info("结束礼包推荐奖分红手动立即分红");
    }







































}
